package com.bafa.util;



	import java.io.UnsupportedEncodingException;
	import java.security.MessageDigest;
	import java.security.NoSuchAlgorithmException;
	import sun.misc.BASE64Encoder;
	import sun.misc.CharacterEncoder;
	public final class PasswordUtil
	{
	  private static PasswordUtil instance;
	  private PasswordUtil()
	  {
	  }
	  public static synchronized String encrypt(String plaintext) 
	  {
	    MessageDigest md = null;
	    try
	    {
	      md = MessageDigest.getInstance("SHA"); //step 2
	    }
	    catch(NoSuchAlgorithmException e)
	    {
	     
	    }
	    try
	    {
	      md.update(plaintext.getBytes("UTF-8")); //step 3
	    }
	    catch(UnsupportedEncodingException e)
	    {
	    }
	    byte raw[] = md.digest(); //step 4
	    String hash = (new BASE64Encoder()).encode(raw); //step 5
	    return hash; //step 6
	  }
	  
	  public static String generatePassword(){
		  
		  
		  return "";
	  }
	  public static synchronized PasswordUtil getInstance() //step 1
	  {
	    if(instance == null)
	    {
	      return new PasswordUtil();
	    } 
	    else    
	    {
	      return instance;
	    }
	  }
	}


